<?php

/**
 * This is the model class for table "web_astor_forecast".
 *
 * The followings are the available columns in table 'web_astor_forecast':
 * @property integer $id
 * @property integer $astor_id
 * @property string $info_uniqueness_check
 * @property integer $zonghe
 * @property integer $aiqing
 * @property integer $gongzuo
 * @property integer $caiyun
 * @property integer $jiankang
 * @property string $lucky_color
 * @property integer $lucky_num
 * @property integer $supei
 * @property string $analysisContent
 * @property integer $info_date
 * @property integer $iscollected
 * @property string $created
 */
class AstorForecast extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return AstorForecast the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'web_astor_forecast';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
		array('astor_id, zonghe, aiqing, gongzuo, caiyun, jiankang, lucky_num, supei, info_date, iscollected', 'numerical', 'integerOnly'=>true),
		array('info_uniqueness_check', 'length', 'max'=>100),
		array('lucky_color', 'length', 'max'=>20),
		array('analysisContent, created', 'safe'),
		// The following rule is used by search().
		// Please remove those attributes that should not be searched.
		array('id, astor_id, info_uniqueness_check, zonghe, aiqing, gongzuo, caiyun, jiankang, lucky_color, lucky_num, supei, analysisContent, info_date, iscollected, created', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'astor_id' => 'Astor',
			'info_uniqueness_check' => 'Info Uniqueness Check',
			'zonghe' => 'Zonghe',
			'aiqing' => 'Aiqing',
			'gongzuo' => 'Gongzuo',
			'caiyun' => 'Caiyun',
			'jiankang' => 'Jiankang',
			'lucky_color' => 'Lucky Color',
			'lucky_num' => 'Lucky Num',
			'supei' => 'Supei',
			'analysisContent' => 'Analysis Content',
			'info_date' => 'Info Date',
			'iscollected' => 'Iscollected',
			'created' => 'Created',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('astor_id',$this->astor_id);
		$criteria->compare('info_uniqueness_check',$this->info_uniqueness_check,true);
		$criteria->compare('zonghe',$this->zonghe);
		$criteria->compare('aiqing',$this->aiqing);
		$criteria->compare('gongzuo',$this->gongzuo);
		$criteria->compare('caiyun',$this->caiyun);
		$criteria->compare('jiankang',$this->jiankang);
		$criteria->compare('lucky_color',$this->lucky_color,true);
		$criteria->compare('lucky_num',$this->lucky_num);
		$criteria->compare('supei',$this->supei);
		$criteria->compare('analysisContent',$this->analysisContent,true);
		$criteria->compare('info_date',$this->info_date);
		$criteria->compare('iscollected',$this->iscollected);
		$criteria->compare('created',$this->created,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}